
#把celery类的实例对象导进来
from celery_tasks.main import celery_app1
from celery_tasks.sms.yuntongxun.sms import CCP

SEND_SMS_TEMP_ID=1
import logging
logger33=logging.getLogger('django')


@celery_app1.task(name='send_sms_code_33')
def send_sms_code_33(mobile,sms_code,expires):
    print('汇报ss:短信发送任务函数被调用啦!')
    try:
        res=CCP().send_template_sms(mobile,[sms_code,expires],SEND_SMS_TEMP_ID)
    except Exception as e:
        logger33.error('汇报ss:发送短信异常:电话:mobile:%s   验证码:sms_code %s'%(mobile,sms_code))
    else:
        if res!=0:
            logger33.error('发送短信失败啦同志:电话mobile:%s  验证码:sms_code:%s'%(mobile,sms_code))
        else:
            #发送成功
            logger33.info('发送短信成功,太棒啦:电话mobile:%s,sms_code:%s'%(mobile,sms_code))


if __name__ == '__main__':
    send_sms_code_33.delay(17612341234, 112233, 1)


